home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / e / mailinglists / amigae.0294feb.archive / 000082_donews!crash!rc…et.edu!AMONROE_Sat, 19 Feb 94 09:59:29 PST.msg < prev    next >
Internet Message Format  |  1994-05-26  |  4KB

  1. Received: by bkhouse.cts.com (V1.17-beta/Amiga)
  2.       id <1vdk@bkhouse.cts.com>; Sat, 19 Feb 94 09:59:29 PST
  3. Received: from crash by donews.cts.com with uucp
  4.     (Smail3.1.28.1 #18) id m0pXXeK-0001vPC; Fri, 18 Feb 94 11:01 EST
  5. Received: from byrd.mu.wvnet.edu by crash.cts.com with smtp
  6.     (Smail3.1.28.1 #18) id m0pXXRP-0000EJC; Fri, 18 Feb 94 07:48 PST
  7. Received: by byrd.mu.wvnet.edu (5.57/Ultrix3.0-C)
  8.     id AA24736; Fri, 18 Feb 94 10:51:33 -0500
  9. Received: From RCBINS/WORKQUEUE by bins00.mu.wvnet.edu
  10.           via Charon-4.0A-VROOM with IPX id 100.940218090812.3104;
  11.           18 Feb 94 10:47:34 +0500
  12. Message-Id: <MAILQUEUE-101.940218090801.256@rcbins.mu.wvnet.edu>
  13. Date:         18 Feb 94 09:08:01 EST
  14. Priority: normal
  15. X-Mailer:     Pegasus Mail v2.3 (R5).
  16. From: "R. Alan Monroe"  <AMONROE@rcbins.mu.wvnet.edu>
  17. To: amigae@bkhouse.cts.com
  18. Subject: The Magic 8 Ball, or how to use AreaEllipse...
  19.  
  20. Here's my wonderful (yeah right :^) )  Magic 8 Ball.
  21. It's really simple.  Ask a question, click on the ball. :^)
  22. And it shows the right (I hope) way to draw circles in a
  23. window on the workbench screen.  If there's any glaring
  24. logical errors in the program flow please tell me, I mean it
  25. runs and all, but I haven't torture tested it :^)
  26. Oh, you need times 18 in fonts:
  27.  
  28. Have fun
  29. Alan
  30.  
  31.  
  32.  
  33. MODULE 'intuition/intuition'
  34. MODULE 'graphics/rastport'
  35. MODULE 'graphics/text'
  36. MODULE 'diskfont'
  37.  
  38. PROC main()
  39.  
  40. DEF fortune, class
  41. DEF eightwin:PTR TO window
  42. DEF arinf:PTR TO areainfo
  43. DEF artmpras:PTR TO tmpras
  44. DEF arcoords[60]:ARRAY
  45. DEF armem
  46. DEF myrast:PTR TO rastport
  47. DEF myitext:PTR TO intuitext
  48. DEF mytextattr:PTR TO textattr
  49. DEF myfont:PTR TO tf
  50.  
  51.   IF diskfontbase := OpenLibrary('diskfont.library',36)
  52.     mytextattr := ['times.font',18,0,1]:textattr
  53.     myfont := OpenDiskFont(mytextattr)
  54.     CloseLibrary(diskfontbase)
  55.   ENDIF
  56.  
  57.   Rnd(-VbeamPos())
  58.  
  59.   IF eightwin := OpenW(0,0,200,210,
  60.                        (IDCMP_MOUSEBUTTONS OR IDCMP_CLOSEWINDOW),
  61.                        (WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR
  62.                         WFLG_CLOSEGADGET OR WFLG_ACTIVATE),
  63.                        'Magic 8 Ball',0,1,0)
  64.  
  65.     fortune := ['Cannot predict now',
  66.                 'Better not tell you now',
  67.                 'Reply hazy try again',
  68.                 'Concentrate & ask again',
  69.                 'Ask again later',
  70.                 'My sources say no',
  71.                 'Outlook not so good',
  72.                 'My reply is no',
  73.                 'Don''t count on it',
  74.                 'Very doubtful',
  75.                 'No',
  76.                 'It is certain',
  77.                 'Signs point to yes',
  78.                 'Most likely',
  79.                 'It is decidedly so',
  80.                 'Outlook good',
  81.                 'Yes, definitely',
  82.                 'As I see it, yes',
  83.                 'You may rely on it',
  84.                 'Yes']
  85.  
  86.     arinf := New(SIZEOF areainfo)
  87.     artmpras := New(SIZEOF tmpras)
  88.     myrast := stdrast
  89.  
  90.     IF armem := AllocRaster(eightwin.width, eightwin.height)
  91.  
  92.       InitTmpRas(artmpras, armem, 5000)
  93.       InitArea(arinf, arcoords, 6)
  94.  
  95.       myrast.tmpras := artmpras
  96.       myrast.areainfo := arinf
  97.  
  98.       SetAPen(stdrast,1)
  99.       SetBPen(stdrast,0)
  100.       /*SetOPen(stdrast,4)*/
  101.       /*myrast.aolpen := 7    Neither of these seem to work */
  102.       AreaMove(stdrast,100,100)
  103.       AreaEllipse(stdrast,100,110,92,92)
  104.       AreaEnd(stdrast)
  105.  
  106.       IF myfont<>0 THEN SetFont(stdrast,myfont)
  107.       Colour(7,1)
  108.       myitext := [7,1,RP_JAM2,NIL,103,mytextattr,NIL,0]:intuitext
  109.  
  110.       WHILE (class := WaitIMessage(eightwin)) <> IDCMP_CLOSEWINDOW
  111.  
  112.         IF (class=IDCMP_MOUSEBUTTONS) AND (MsgCode()=SELECTUP)
  113.           /*TextF(46,108,'\s',ListItem(fortune,(Rnd(8))) )*/
  114.           myitext.itext := ListItem(fortune,(Rnd(20)))
  115.           myitext.leftedge := 100-(IntuiTextLength(myitext)/2)
  116.           PrintIText(myrast, myitext, 0, 0)
  117.           Delay(75)
  118.           Box(9,94,190,120,1)
  119.         ENDIF
  120.  
  121.       ENDWHILE
  122.  
  123.       FreeRaster(armem, eightwin.width, eightwin.height)
  124.  
  125.     ELSE
  126.       TextF(70,100,'No mem for circle drawing!')
  127.       Delay(75)
  128.  
  129.     ENDIF
  130.  
  131.     IF myfont THEN CloseFont(myfont)
  132.     CloseW(eightwin)
  133.  
  134.   ENDIF
  135.  
  136.   CleanUp(0)
  137. ENDPROC